<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:common="http://java.sun.com/jsf/composite/common">
<h:body>
	<ui:composition template="/pages/templates/MainTemplate.xhtml">
		<ui:define name="content">
			<h:form id="dialogForm">
				<p:growl id="messages" globalOnly="true" showDetail="true"
					showSummary="true" closable="true" autoUpdate="true" />

				<legend>Ordenes de produccion</legend>
				<common:CRUDMenuBar id="ordnProdMenuBar"
					crudManagedBean="#{ordenProdMB}">
				</common:CRUDMenuBar>
				<ui:include src="produccion/ordenProdList.xhtml"></ui:include>
				<h:panelGroup layout="block" id="detailsPanel"
					style="margin-top:10px;">
					<h:panelGroup layout="block" id="prodDetails"
						rendered="#{ordenProdMB.renderPerformedWork}">
						<legend>
							Planilla de trabajos:
							<h:outputText value=" #{ordenProdMB.selectedOp.id}"></h:outputText>
						</legend>
						<h:panelGroup layout="block">
							<common:prodSpecs ordenProd="#{ordenProdMB.selectedOp}"
								id="prodSpecs" showWorkPanels="true">
							</common:prodSpecs>
						</h:panelGroup>
					</h:panelGroup>

					<h:panelGroup layout="block"
						rendered="#{ordenProdMB.renderOpDetails}">
						<legend>
							Detalles de OP:
							<h:outputText value=" #{ordenProdMB.selectedOp.id}"></h:outputText>
						</legend>
						<common:ordneProdData ordenProd="#{ordenProdMB.selectedOp}"
							id="detallesPedidoID"></common:ordneProdData>
						<hr></hr>
						<common:itemDataRO id="itemsData"
							item="#{ordenProdMB.selectedOp.item}"
							tipoMaterial="#{ordenProdMB.tipoMaterial}"></common:itemDataRO>
						<hr></hr>
					</h:panelGroup>
					<h:panelGroup id="commentsPanel">
						<common:opComments rendered="#{ordenProdMB.renderOpComments}"
							comments="#{ordenProdMB.selectedOp.opComments}" id="comments">
						</common:opComments>
					</h:panelGroup>
				</h:panelGroup>

				<p:dialog showEffect="clip" hideEffect="clip"
					header="Agregar Comentario" id="commentDialogId"
					widgetVar="commentDialog" focus="comment">
					<h:panelGrid style="margin-bottom:10px">
						<p:row>
							<p:column>
								<h:outputLabel for="comment" value="Comentario" />
								<p:inputTextarea id="comment" value="#{ordenProdMB.comment}"
									rows="2" counter="counter" maxlength="150"
									counterTemplate="{0} caracteres restantes."
									style="width: 100%;" />
								<h:outputText id="counter" style="margin-bottom:10px;" />
							</p:column>
						</p:row>
					</h:panelGrid>
					<p:commandButton id="submitButton" value="Agregar Comentario"
						process="@this,comment" action="#{ordenProdMB.performAction}"
						update=":dialogForm:dataTable :dialogForm:detailsPanel"
						oncomplete="javascript:window.location='#logo' dlg.hide();"
						icon="ui-icon-comment" />
					<p:commandButton id="cancelButton" value="Cancelar"
						oncomplete="commentDialog.hide();" process="@this"
						icon="ui-icon-cancel"></p:commandButton>
				</p:dialog>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>